var express = require('express');
var multer  = require('multer');

var router = express.Router();

var storage = multer.diskStorage({
  destination: function (req, file, cb) {
    cb(null, '/home/zhangwei')
  },
  filename: function (req, file, cb) {
    cb(null, file.fieldname + '-' + Date.now())
  }
})

var upload = multer({storage: storage}).any();

router.post('/:projectName/:document',function(req, res, next) {  //基础信息
  
});

router.post('/test2',function(req, res, next) {  //基础信息
  upload(req, res, function(err) {
    console.log("req.files",req.files);
    console.log("req.file",req.file); 
    if(err) {
        console.log(err);
        res.send(err)
    } else {
        res.send("success")
    }
   });
});

module.exports = router;